package org.jivesoftware.smackx.pubsub;

import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;

public class NodeExtension
  implements PacketExtension
{
  private PubSubElementType element;
  private String node;

  public NodeExtension(PubSubElementType paramPubSubElementType)
  {
    this(paramPubSubElementType, null);
  }

  public NodeExtension(PubSubElementType paramPubSubElementType, String paramString)
  {
    this.element = paramPubSubElementType;
    this.node = paramString;
  }

  public String getElementName()
  {
    return this.element.getElementName();
  }

  public String getNamespace()
  {
    return this.element.getNamespace().getXmlns();
  }

  public String getNode()
  {
    return this.node;
  }

  public String toString()
  {
    return super.getClass().getName() + " - content [" + toXML() + "]";
  }

  public String toXML()
  {
    String str;
    StringBuilder localStringBuilder = new StringBuilder(String.valueOf('<')).append(getElementName());
    if (this.node == null)
      str = "";
    while (true)
    {
      return str + "/>";
      str = " node='" + this.node + '\'';
    }
  }
}